namespace ICSharpCode.TextEditor.Document
{
    public class HighlightingStrategyFactory
    {
        public static IHighlightingStrategy CreateHighlightingStrategy()
        {
            return (IHighlightingStrategy)HighlightingManager.Manager.HighlightingDefinitions["Default"];
        }

        public static IHighlightingStrategy CreateHighlightingStrategy(string name)
        {
            IHighlightingStrategy highlightingStrategy = HighlightingManager.Manager.FindHighlighter(name);
            if (highlightingStrategy == null)
            {
                return CreateHighlightingStrategy();
            }
            return highlightingStrategy;
        }

        public static IHighlightingStrategy CreateHighlightingStrategy(string theme, string name)
        {
            IHighlightingStrategyUsingRuleSets highlightingStrategyUsingRuleSets = null;
            highlightingStrategyUsingRuleSets = ((!(theme == "Black")) ? ((IHighlightingStrategyUsingRuleSets)new DefaultHighlightingStrategy()) : ((IHighlightingStrategyUsingRuleSets)new BlackHighlightingStrategy()));
            IHighlightingStrategy highlightingStrategy = HighlightingManager.Manager.FindHighlighter(highlightingStrategyUsingRuleSets, name);
            if (highlightingStrategy == null)
            {
                return CreateHighlightingStrategy();
            }
            return highlightingStrategy;
        }

        public static IHighlightingStrategy CreateHighlightingStrategyForFile(string fileName)
        {
            IHighlightingStrategy highlightingStrategy = HighlightingManager.Manager.FindHighlighterForFile(fileName);
            if (highlightingStrategy == null)
            {
                return CreateHighlightingStrategy();
            }
            return highlightingStrategy;
        }
    }
}
